import { _decorator } from "cc";

/**
 * 游戏数据
 */
const { ccclass, property } = _decorator;
@ccclass('Data')
export class Data {

    //去除彩虹得数组
    static FishIndexArr: number[] = [0, 1, 3, 4];

    //彩虹索引
    static FishRainbowIndex: number = 2;

    //彩虹概率
    static FishRainbowRate: number = 0.1;

    /**
     * 返回颜色
     */
    static ReturnFishColor(): number {
        let color_index: number = this.FishRainbowIndex;

        let rn: number = Math.random();

        if (rn > this.FishRainbowRate) {
            color_index = this.FishIndexArr[Math.floor(Math.random() * this.FishIndexArr.length)];
        }

        return color_index;
    }

}


